package co.com.javeriana.aes.touresbalon.webserviceclients;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.datacontract.schemas._2004._07.b2c_core.City;

/**
 *
 * @author Jonathan Fernandez <jonathan.fvargas@gmail.com>
 */
public class CitiesClient {

    public static Map<Integer, String>  getCities() {

    Map<Integer, String> nombreMap = new HashMap<>();
        
        try { // Call Web Service Operation
            org.tempuri.OperationCities service = new org.tempuri.OperationCities();
            org.tempuri.ICities port = service.getBasicHttpBindingICities();
            // TODO process result here
            org.datacontract.schemas._2004._07.b2c_core.ArrayOfCity result = port.getAllCities();
            
            List <City> ci=result.getCity();
            
            for (City ci1 : ci) {
                nombreMap.put(ci1.getId(),ci1.getName());
            }
            
            System.out.println("Result = "+result);
        
        } catch (Exception ex) {
            // TODO handle custom exceptions here
        }

        return nombreMap;
        
    }

    public static void main(String args[]) {

       getCities();

    }

}
